<?$this->headLink()->appendStylesheet($this->baseUrl('css/jquery.ibutton.min.css'));?>
<?$this->headScript()->offsetSetFile(52,$this->baseUrl('js/jquery.ibutton.js'),'text/javascript');?>

<?php $this->placeholder('onReady')->captureStart() ?>
	$("#<?php echo $this->id_tablesorter?>").tablesorter(); 
    
    $("input.iButton").iButton( {
            labelOn: "Si", 
            labelOff: "No",
            widthHandle:15,
            widthOn:15,
            widthOff:20,
    });
    

    $(document).on("change",'input.iButton', function(e){
        var aux = $(this).closest('tr').attr('id');
        var id= aux.replace('tr_','');
        bFlag = $(this).is(':checked');
       	$.post('/contadores/checkbox',{id: id,idZona: <?=$this->idZona?>,checked:bFlag});
    })
        
    <?=$this->partial("snnipet/qtip.phtml");?>    
<?php $this->placeholder('onReady')->captureEnd() ?>


<div class="contenedor_tablesorter">

<?if($this->msgPost)$this->partial('snnipet/atencion.phtml',array('msg'=>$this->translate('Usa los filtros para realizar la busqueda.')));?>

<?php echo $this->insertarFila($this->controllerName,$this->idZona,null,'Añadir Contador');?>

<?if($this->rows):?>
<table id="<?= $this->id_tablesorter?>" width="100%" class=""> 
    <?=$this->partial('snnipet/caption.phtml',array('c'=>count($this->rows)))?>

    <thead>
    <tr>
        <th><?php echo $this->translate('Código');?></th>
        <th><?php echo $this->translate('Número');?></th>
        <th><?php echo $this->translate('Proyecto');?></th>
        <th><?php echo $this->translate('Nombre');?></th>
        <th><?php echo $this->translate('Sala');?></th>
        <th><?php echo $this->translate('CC');?></th>
        <th><?php echo $this->translate('Tipo');?></th>
        <th><?php echo $this->translate('Puesta en marcha');?> kW</th>
        <th><?php echo $this->translate('Circuito');?></th>
        <th><?php echo $this->translate('Cuadro');?></th>
        <th><?php echo $this->translate('Activo');?></th>
        <th class="filter-false"></th>
    </tr>
    </thead>
    <tbody>
        <?php echo $this->partialLoop($this->controllerName.'/fila.phtml', (array)$this->rows); ?>	
    </tbody>
</table>
<?endif?>
</div>